package com.neuedu.his.controller;

import com.neuedu.his.entity.MedicalRecord;
import com.neuedu.his.entity.Register;
import com.neuedu.his.service.MedicalRecordService;
import com.neuedu.his.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;


@RestController
@RequestMapping("/MedicalRecord")
public class MedicalRecordController {

    @Autowired
    private MedicalRecordService MedService;

    @Autowired
    private RegisterService RegService;

   // http://localhost:8088/MedicalRecord/selectAll
    @RequestMapping("/selectAll")
    public List<MedicalRecord> selectAll(MedicalRecord med){
        return MedService.selectAll(med);
    }

    @RequestMapping("/selectById")
    // http://localhost:8088/MedicalRecord/selectById?id=6
    public MedicalRecord selectById(MedicalRecord med){
        return MedService.selectById(med);
    }

    @RequestMapping("/update")
    // http://localhost:8088/MedicalRecord/update?checkresult=肺炎&careful=121&diagnosis=121&handling=2121&casestate=1&id=9
    public int update(MedicalRecord med){
        return MedService.update(med);
    }

    @RequestMapping("/UpdateToStorage")
    // http://localhost:8088/MedicalRecord/UpdateToStorage?checkresult=肺炎&careful=121&diagnosis=121&handling=2121&id=10
    public int UpdateToStorage(MedicalRecord med) {
        return MedService.UpdateToStorage(med);
    }

    @RequestMapping("/UpdateToSub")
    // http://localhost:8088/MedicalRecord/UpdateToSub?id=10
    public int UpdateToSub(MedicalRecord med){
        return MedService.UpdateToSub(med);
    }

    @RequestMapping("UpdateToDef")
    // http://localhost:8088/MedicalRecord/UpdateToDef?id=20
    public int UpdateToDef(MedicalRecord med){
        return MedService.UpdateToDef(med);
    }


    @RequestMapping("/selectByCaseNumber")
    // http://localhost:8088/MedicalRecord/selectByCaseNumber?casenumber=600607
    public MedicalRecord selectByCaseNumber(MedicalRecord CaseNumber){
        return MedService.selectByCaseNumber(CaseNumber);
    }

    @RequestMapping("/selectByRealName")
    // http://localhost:8088/MedicalRecord/selectByRealName?realname=李贺
    public MedicalRecord selectMedRecordByRealName(Register reg){
        return MedService.selectMedRecordByRealName(reg);
    }

    //清空操作返回空列表
    @RequestMapping("/Empty")
    // http://localhost:8088/MedicalRecord/Empty
    public List<MedicalRecord> Empty(){
        return Collections.emptyList();
    }

    @RequestMapping("/selectUndefinite")
    // http://localhost:8088/MedicalRecord/selectUndefinite
    public List<MedicalRecord> selectUnfinite(MedicalRecord med){
        return MedService.selectUndefinite(med);
    }

    @RequestMapping("/selectDefinite")
    // http://localhost:8088/MedicalRecord/selectDefinite
    public List<MedicalRecord> selectDefinite(MedicalRecord med){
        return MedService.selectDefinite(med);
    }
}
